Hi Brad,
CheckDone(axis) returns
0 - if not done
1 - if done
-1 if axis disabled
So your code is treating disabled as done
regards
TK
Group: DynoMotion |
Message: 5129 |
From: bradodarb |
Date: 6/1/2012 |
Subject: Re: persist data returning bad values |
Hello, Tom,
I don't understand the relevence of what checkdone returns.
I am setting the persistdata based on whether the home bit is flagged or not.
Thanks,
-Brad Murry
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Brad,
> Â
> CheckDone(axis) returns
> Â Â Â Â 0 - if not done
> Â Â Â Â 1 - if done
> Â Â Â Â -1 if axis disabled
> Â
> So your code is treating disabled as done
> Â
> regards
> TKÂ
>
> From: bradodarb <bradodarb@...>
> To: DynoMotion@yahoogroups.com
> Sent: Friday, June 1, 2012 8:46 PM
> Subject: [DynoMotion] persist data returning bad values
>
>
> Â
> Hello Tom,
>
> I have a machine I'm working on and having some issues with homing routine.
>
> Actually the homing works great along with all other functionality.
> The issue I am having is with the persitdata array.
>
> Before I generate and call the home routine, I set a persistdata to 1 and inside the home routine I set it back to zero if successful.
>
> So in MM, I disable the start buttons on the UI while homing, call the home routine and then poll that persistdata value until it is the right state and then enable the UI again or call an error if it times out.
>
> The problem is when I E-Stop the machine , the persistdata comes back immediately as a 1, no matter what point it is in the home routine.
>
> **Note I do not kill power to kflop on Estop, here is what gets called from my MM axis wrappers-
> KM_Axis.Stop()
> KM_Axis.Disable()
>
> And here is the generated homing sequence:
>
> #include "KMotionDef.h"
>
> void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset);
>
> main()
> {
> persist.UserData[10] = 0;
> DoHome( 0, // X
> 30000, // speed steps/sec
> 1, // direction to home
> 44, // home input bit
> 1, // bit polarity (0 or 1) when tripped
> 1000); // amount to move back inside (counts)
>
> }
>
> void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset)
> {
> float oppdir = dir * -1;
>
> EnableAxis(axis);
> if(ReadBit(bit)==polarity)
> {
> Jog(axis, speed * oppdir);
> while (ReadBit(bit) == polarity) ;
> Jog(axis,0);
> MoveRelAtVel(axis,sensoroffset * oppdir,speed);
> while(!CheckDone(0));
> }
>
> Jog(axis, speed * dir);
> while (ReadBit(bit) != polarity)
> {
> persist.UserData[10] = 0;
> }
> Jog(axis,0);
> while(!CheckDone(0));
> if(ReadBit(bit)== polarity)
> {
> persist.UserData[10] = 1; // Signal MM that homing has completed
> }
>
> MoveRelAtVel(axis,sensoroffset * oppdir,speed);
> Zero(0);
> }
>
> I cannot understand why persistdata would suddenly return 1 instead of zero.... please advise.
>
> Thanks,
> -Brad Murry
>
|
|
Group: DynoMotion |
Message: 5132 |
From: Tom Kerekes |
Date: 6/1/2012 |
Subject: Re: persist data returning bad values |
Hi Brad,
Yes you are right I didn't think it through properly.
There are a few confusing things to me, but I don't see how they could cause the program to terminate without the input.
I would add print statements in order to debug it. And/or delete things to simplify it:
Maybe EStop generates noise on the input?
Here are some things that seem odd:
#1 - why set the flag to zero so many places and continuously??
#2 - I thought you said 0 if successful? Didn't you mean 1?
#3 - A Jog(0,0) before a move (without any wait) is unnessary and has no effect.
TK
Group: DynoMotion |
Message: 5134 |
From: Brad Murry |
Date: 6/1/2012 |
Subject: Re: persist data returning bad values |
Hello Tom, No problem, it was kind of a brain dump of what was going on and as always I appreciate your efforts. The extra set to zeros I put in there to force it and I did have printf’s to make sure it was happy.(the code I pasted is modified from what I am generating with the KM_Axis class). And as the printf’s and excellent machine behavior during normal conditions suggest- it works swell….. until Estop condition. Yes, 0 == homing 1 == homing complete. During debugging, I also tried checking IO state both visually in Digital IO and with printf’s and could detect no state change. I’m not sure what is happening. **Duly noted on the superfluous jog0’s… Thanks again, -Brad Murry From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes Sent: Friday, June 01, 2012 10:37 PM To: DynoMotion@yahoogroups.com Subject: Re: [DynoMotion] Re: persist data returning bad values Yes you are right I didn't think it through properly. There are a few confusing things to me, but I don't see how they could cause the program to terminate without the input. I would add print statements in order to debug it. And/or delete things to simplify it: Maybe EStop generates noise on the input? Here are some things that seem odd: #1 - why set the flag to zero so many places and continuously?? #2 - I thought you said 0 if successful? Didn't you mean 1? #3 - A Jog(0,0) before a move (without any wait) is unnessary and has no effect. Hello, Tom,
I don't understand the relevence of what checkdone returns.
I am setting the persistdata based on whether the home bit is flagged or not.
Thanks,
-Brad Murry
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote: > > Hi Brad, > Â > CheckDone(axis) returns > Â Â Â Â 0 - if not done > Â Â Â Â 1 - if done > Â Â Â Â -1 if axis disabled > Â > So your code is treating disabled as done > Â > regards > TKÂ > > From: bradodarb <bradodarb@...> > To: DynoMotion@yahoogroups.com > Sent: Friday, June 1, 2012 8:46 PM > Subject: [DynoMotion] persist data returning bad values > > > Â > Hello Tom, > > I have a machine I'm working on and having some issues with homing routine. > > Actually the homing works great along with all other functionality. > The issue I am having is with the persitdata array. > > Before I generate and call the home routine, I set a persistdata to 1 and inside the home routine I set it back to zero if successful. > > So in MM, I disable the start buttons on the UI while homing, call the home routine and then poll that persistdata value until it is the right state and then enable the UI again or call an error if it times out. > > The problem is when I E-Stop the machine , the persistdata comes back immediately as a 1, no matter what point it is in the home routine. > > **Note I do not kill power to kflop on Estop, here is what gets called from my MM axis wrappers- > KM_Axis.Stop() > KM_Axis.Disable() > > And here is the generated homing sequence: > > #include "KMotionDef.h" > > void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset); > > main() > { > persist.UserData[10] = 0; > DoHome( 0, // X > 30000, // speed steps/sec > 1, // direction to home > 44, // home input bit > 1, // bit polarity (0 or 1) when tripped > 1000); // amount to move back inside (counts) > > } > > void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset) > { > float oppdir = dir * -1; > > EnableAxis(axis); > if(ReadBit(bit)==polarity) > { > Jog(axis, speed * oppdir); > while (ReadBit(bit) == polarity) ; > Jog(axis,0); > MoveRelAtVel(axis,sensoroffset * oppdir,speed); > while(!CheckDone(0)); > } > > Jog(axis, speed * dir); > while (ReadBit(bit) != polarity) > { > persist.UserData[10] = 0; > } > Jog(axis,0); > while(!CheckDone(0)); > if(ReadBit(bit)== polarity) > { > persist.UserData[10] = 1; // Signal MM that homing has completed > } > > MoveRelAtVel(axis,sensoroffset * oppdir,speed); > Zero(0); > } > > I cannot understand why persistdata would suddenly return 1 instead of zero.... please advise. > > Thanks, > -Brad Murry >
|
|
| | | |